import Opt from '@/components/dt/info/Opt.js'
import table from '@/components/dt/table/render.js'

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        title: '案场海报预览',
        field: 'count2',
        minWidth: 180,
        slots: {
          default: (params, h) => {
            let img = {
              event: params.row.previewUrl ? 'lookImg' : '',
              src: params.row.previewUrl ? params.row.previewUrl : '-',
              data: [params.row.previewUrl ? params.row.previewUrl : '-']
            }
            return table.cell.img(_this, h, img, true)
          }
        }
      },
      {
        field: 'scanCodeType',
        title: '扫码落地页',
        minWidth: 160,
        header: {
          filter: {
            key: 'scanCodeType',
            title: '扫码落地页',
            placeholder: '请选择扫码落地页',
            select: {
              key: 'scanCodeType'
            }
          }
        }
      },
      {
        field: 'quoteCount',
        title: '推广总次数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'quoteCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'scanCount',
        title: '扫码总次数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'scanCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'addClueCount',
        title: '新增线索总数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'addClueCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'wechatShareCount',
        title: '微信分享次数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'wechatShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'scanShareCount',
        title: '扫码数（分享）',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'scanShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'addClueShareCount',
        title: '新增线索数（分享）',
        minWidth: 180,
        remoteSort: true,
        sort: {
          key: 'addClueShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'friendShareCount',
        title: '朋友圈分享次数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'friendShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'scanFriendCount',
        title: '扫码数（朋友圈）',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'scanFriendCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'addClueFriendCount',
        title: '新增线索数（朋友圈）',
        minWidth: 200,
        remoteSort: true,
        sort: {
          key: 'addClueFriendCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'savePicShareCount',
        title: '保存图片数',
        minWidth: 160,
        remoteSort: true,
        sort: {
          key: 'savePicShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'scanPicShareCount',
        title: '扫码数（保存图片）',
        minWidth: 180,
        remoteSort: true,
        sort: {
          key: 'scanPicShareCountSort',
          desc: '2',
          asc: '1'
        }
      },
      {
        field: 'addCluePicShareCount',
        title: '新增线索（保存图片）',
        minWidth: 200,
        remoteSort: true,
        sort: {
          key: 'addCluePicShareCountSort',
          desc: '2',
          asc: '1'
        }
      }
    ]
  }
}

export default Column
